<?php
require_once ('dbconfig.php');
?>
<html>
<head>
<title>Alliance Taxable Moons</title>
</head>
<body onload="CCPEVE.requestTrust('http://swamp.rokitt-web.com')">

<?php
$dbh = mysql_connect ( DB_HOST, DB_USER, DB_PASS ) or die ( mysql_error () );
mysql_select_db ( DB_NAME );
$sql = "select alTmId, alTmSystem, alTmPlanet, alTmMoon, alCorpName, alTaxRate, alTaxDesc from al_taxableMoons, al_corps, al_taxRate where alTmCorp = alCorpId and alTmRate = alTaxRateId order by alTmCorp, alTmSystem, alTmRate";
$result = mysql_query ( $sql, $dbh ) or die ( mysql_error () );

$moonTable ="<table cellpadding=1 cellspacing=1 border=1>";
$moonTable .= "<tr><td><b>Corporation</b></td><td><b>System</b></td>";
$moonTable .= "<td><b>Planet</b></td><td><b>Moon</b></td>";
$moonTable .= "<td align=\"right\"><b>Tax Rate</b></td>";
$moonTable .= "<td><b>Operations</b></td></tr>";


while ( $newArray = mysql_fetch_array ( $result ) ) {
	$corpName = $newArray ['alCorpName'];
	$systemName = $newArray ['alTmSystem'];
	$planet = $newArray ['alTmPlanet'];
	$moon = $newArray ['alTmMoon'];
	$tax = $newArray ['alTaxRate'];
	$moonId = $newArray ['alTmId'];
	
	$moonTable .= "<tr><td>$corpName</td><td>$systemName</td><td align =\"center\">$planet</td><td align = \"center\">$moon</td><td align = \"right\">";
	$moonTable .= number_format ( $tax, 2 );
	$moonTable .= "</td><td><a href=\"http://swamp.rokitt-web.com/al_tools/deleteMoon.php?moonId=$moonId&corpname=$corpName&system=$systemName&planet=$planet&moon=$moon&mode=1\">Delete</a></td></tr>";
	
} //end of while loop

$moonTable .= "</table>";

echo $moonTable;
?>
<br>
<form action=addMoon.php " method="post">
<input type="submit" name="submit" value="Add Moon">
</form>

</body>
</html>